package com.injection;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MainInjection {
    public static void main(String[] args) {
        ApplicationContext context =
                new ClassPathXmlApplicationContext("Beans.xml");
        TextEditor te= (TextEditor) context.getBean("TextEditor");
        te.spellCheck();
        mainInjectionSet();
    }

//    基于设值函数注入中的 Beans.xml 文件
    private static void mainInjectionSet() {
        System.out.println("基于设值函数注入中的 Beans.xml 文件");
        ApplicationContext context =
                new ClassPathXmlApplicationContext("Beans.xml");
        TextEditorSet te= (TextEditorSet) context.getBean("TextEditorSet");
        te.spellCheck();
    }
}
